<%@ Register TagPrefix="cc2" Namespace="PHSRAG.WebControls" Assembly="PHSRAG.WebControls" %>
<%@ Register TagPrefix="cc1" Namespace="PHSRAG.Insight21.InsightWebControls" Assembly="PHSRAG.Insight21.InsightWebControls" %>

<%@ Page Language="c#" Inherits="PHSRAG.Insight21.Admin.RefCodeManagement" CodeFile="RefCodeManagement.aspx.cs" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>RefCodeManagement</title>
	<link href="../Insight21.css" type="text/css" rel="stylesheet" />
</head>
<body>
	<form id="refCodeManagement" method="post" runat="server">
		<table class="Container" cellpadding="0">
			<tr>
				<td>
					<table class="Header" width="100%">
						<tr>
							<td>
								<cc1:Header ID="header" runat="server" OnNavigate="OnNavigate" />
							</td>
						</tr>
						<tr>
							<td>
								<cc1:AdminSubNavigation ID="adminSubNavigation" runat="server"></cc1:AdminSubNavigation>
							</td>
						</tr>
					</table>
					<cc2:ActivityIndicator ID="activityIndicator" runat="server"></cc2:ActivityIndicator>
					<cc2:BreadCrumb ID="breadCrumb" runat="server"></cc2:BreadCrumb>
					<table width="100%">
						<tr>
							<td>
								<cc2:Annunciator ID="annunciator" runat="server"></cc2:Annunciator>
							</td>
						</tr>
					</table>
					<table>
						<tr>
							<td>
								<asp:ValidationSummary ID="valSummary" runat="server" Width="100%" HeaderText="The following errors occurred:" />
							</td>
						</tr>
					</table>
					<cc2:PostbackGuard ID="postbackGuard" runat="server"></cc2:PostbackGuard>
					<table width="100%">
						<tr>
							<td colspan="2">
								Add New Domain:
								<asp:CheckBox ID="addNewDomain" runat="server" AutoPostBack="True" OnCheckedChanged="OnAddNewDomainCheckedChanged">
								</asp:CheckBox>&nbsp;
								<asp:TextBox ID="newDomain" runat="server" CssClass="FlatTextBox" Visible="False"></asp:TextBox><asp:DropDownList
									ID="domain" runat="server" AutoPostBack="True" CssClass="FlatDropDown" OnSelectedIndexChanged="OnDomainSelectedIndexChanged">
								</asp:DropDownList>
								<asp:RegularExpressionValidator ID="revDomain" runat="server" ControlToValidate="newDomain"
									ErrorMessage="Domain must start with an alphabet and can only be alphanumeric with an optional underscore"
									ValidationExpression="[a-zA-Z][a-zA-Z0-9_]+" ToolTip="Domain must start with an alphabet and can only be alphanumeric with an optional underscore">*</asp:RegularExpressionValidator></td>
						</tr>
						<tr>
							<td colspan="2">
								&nbsp;</td>
						</tr>
						<tr>
							<td colspan="2">
								<asp:Panel ID="gridContainer" runat="server" Visible="False">
									<table class="DataTitle" cellspacing="0" width="100%">
										<tr>
											<td>
												Data Management |
												<asp:Label ID="recordCount" runat="server"></asp:Label>&nbsp;Records&nbsp;
											</td>
										</tr>
									</table>
									<table cellspacing="0" width="100%">
										<tr>
											<td>
												<cc2:Pager ID="topPager" runat="server" OnFirstPage="OnFirstPage" OnLastPage="OnLastPage"
													OnNextPage="OnNextPage" OnPreviousPage="OnPreviousPage" />
											</td>
										</tr>
									</table>
									<table cellspacing="0" width="100%">
										<tr>
											<td>
												<asp:DataGrid ID="refCodes" runat="server" AllowCustomPaging="True" AllowPaging="True"
													AllowSorting="True" AutoGenerateColumns="False" CssClass="DataGrid" OnCancelCommand="OnRefCodesCancelCommand"
													OnEditCommand="OnRefCodesEditCommand" OnItemDataBound="OnRefCodesItemDataBound"
													OnUpdateCommand="OnRefCodesUpdateCommand" Width="100%">
													<AlternatingItemStyle CssClass="DataGridAlternatingItem"></AlternatingItemStyle>
													<ItemStyle CssClass="DataGridItem"></ItemStyle>
													<HeaderStyle CssClass="DataGridHeader"></HeaderStyle>
													<Columns>
														<asp:TemplateColumn HeaderText="Code">
															<ItemTemplate>
																<asp:Label ID="refCode" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Code")%>'>
																</asp:Label>
															</ItemTemplate>
															<EditItemTemplate>
																<asp:Label ID="refCodeStatic" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Code")%>'>
																</asp:Label>
																<asp:TextBox ID="refCodeEdit" runat="server" CssClass="FlatTextBox" Text='<%#DataBinder.Eval(Container.DataItem, "Code")%>'>
																</asp:TextBox>
																<asp:RegularExpressionValidator ID="revRefCode" runat="server" ControlToValidate="refCodeEdit"
																	ErrorMessage="Code must start with an alphabet and can only be alphanumeric with an optional underscore"
																	ValidationExpression="[a-zA-Z][a-zA-Z0-9_]+" ToolTip="Code must start with an alphabet and can only be alphanumeric with an optional underscore">*</asp:RegularExpressionValidator>
															</EditItemTemplate>
														</asp:TemplateColumn>
														<asp:TemplateColumn HeaderText="Value">
															<ItemTemplate>
																<asp:Label runat="server" ID="refMeaning" Text='<%#DataBinder.Eval(Container.DataItem, "Meaning")%>'>
																</asp:Label>
															</ItemTemplate>
															<EditItemTemplate>
																<asp:TextBox ID="refMeaningEdit" runat="server" CssClass="FlatTextBox" Text='<%#DataBinder.Eval(Container.DataItem, "Meaning")%>'>
																</asp:TextBox>
															</EditItemTemplate>
														</asp:TemplateColumn>
														<asp:TemplateColumn HeaderText="Active">
															<ItemTemplate>
																<asp:Label ID="active" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Active")%>'>
																</asp:Label>
															</ItemTemplate>
															<EditItemTemplate>
																<asp:CheckBox ID="activeEdit" runat="server" Checked='<%#(DataBinder.Eval(Container.DataItem, "Active").ToString() == "Y")%>'>
																</asp:CheckBox>
															</EditItemTemplate>
														</asp:TemplateColumn>
														<asp:EditCommandColumn UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
													</Columns>
													<PagerStyle Visible="False"></PagerStyle>
												</asp:DataGrid></td>
										</tr>
									</table>
									<table cellspacing="0" width="100%">
										<tr>
											<td>
												<cc2:Pager ID="bottomPager" runat="server" OnFirstPage="OnFirstPage" OnLastPage="OnLastPage"
													OnNextPage="OnNextPage" OnPreviousPage="OnPreviousPage" />
											</td>
										</tr>
									</table>
								</asp:Panel>
							</td>
						</tr>
						<tr>
							<td colspan="2">
								&nbsp;</td>
						</tr>
						<tr>
							<td align="left">
								<asp:Button ID="add" runat="server" CssClass="Button" Enabled="False" Text="Add New Code"
									OnClick="OnAddRow"></asp:Button></td>
							<td align="right">
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</form>
</body>
</html>
